/*
 * Exploder
 * 
 * Tero Pyylampi (218437), Jussi Tuurinkoski (211594)
 *
 * Main game layer
 */

#ifndef LAYERGAME_H
#define LAYERGAME_H

#include "cocos2d.h"
#include "Box2D/Box2D.h"

class GameScene;
class GameCamera;
class MainEngine;
class GameTouchHandle;
class GamePhysicObject;
class GameEngine;
class GameBomb;

class LayerGame : public cocos2d::CCLayer {
public:
	// default constructor
	LayerGame( GameScene *scene, GameCamera *camera );
	// default destructor
	~LayerGame();

	// initialize this scene
	void initializeLayer();

	// update -function
	virtual void update( cocos2d::ccTime dt );
	
	// called when the user puts the finger on the screen
	virtual void ccTouchesBegan( cocos2d::CCSet *touches, cocos2d::CCEvent *event );
	// called when the finger moves on the screen
	virtual void ccTouchesMoved( cocos2d::CCSet *touches, cocos2d::CCEvent *event );
	// called when the user lifts the finger from the screen
	virtual void ccTouchesEnded( cocos2d::CCSet *touches, cocos2d::CCEvent *event );

	// get master
	GameScene *getGameScene();
	// get game engine
	GameEngine *getGameEngine();

	// get touch handle
	GameTouchHandle *getTouchHandle();

private:
	// pointer to the main game scene
	GameScene *mGameScene;
	// pointer to the game camera
	GameCamera *mGameCamera;
	// main game engine
	GameEngine *mGameEngine;

	// touch handler for input
	GameTouchHandle *mTouchHandle;

	// check for interface physic object button presses
	b2Body *checkForInterfacePhysicObjectButtonPresses( cocos2d::CCPoint &screenCoords, b2Vec2 &worldCoords );
	// check for existing bomb presses
	GamePhysicObject *checkForExistingPhysicObjects( cocos2d::CCPoint &screenCoords, b2Vec2 &worldCoords );
};

#endif